import pandas as pd
from datetime import date

file = '20241014'
data = 'FastPlot DataFile 0'

path = r'E:\试飞数据\双机试飞数据'+ '\\' + file + '\\' + data +'.txt'

df = pd.read_csv(path, sep='\t')

print(df)
print(df.columns)

# 调整双机参数顺序,如果换参数名称需调整
plane_info = ['altitude_1','longitude_1','latitude_1','A_IOC_17L_171_COMPUTED_AIRSPEED',
              'magnetic_1','altitude_2','Longitude','Latitude','FCM1_Voted_Calibrated_Airspeed',
              'magnetic_2','index']

df_rearrange = df.reindex(columns = plane_info)

# 重新设置时间索引列
df_change_index = df_rearrange.set_index(['index'])

# 截取关键时刻
# result = df_change_index.loc['16:22:00:000000':'16:28:00:000000']
result = df_change_index
# 设置存储路径
path_out = r'E:\software development\TCAS\other\NC' + '\\' + 'NC_two_plane' + str(date.today()) + '.csv'

print(path_out)


result.to_csv(path_out)


#print(df_change_index)
